package top.buyibuyi.course.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.buyibuyi.course.R;
import top.buyibuyi.course.pojo.ChooseCourse;
import top.buyibuyi.course.service.AddChooseService;

@RestController
@CrossOrigin
@RequestMapping("/course")
public class AddChooseController {

    @Autowired
    private AddChooseService addChooseService;

    @PostMapping("/addChoose")
    public R addChoose(@RequestBody ChooseCourse chooseCourse){
        try {
            Boolean aBoolean = addChooseService.addChoose(chooseCourse);
            return R.ok().data("data",aBoolean);
        }catch (Exception e){
            e.printStackTrace();
            return R.error();
        }
    }
}
